<!DOCTYPE html>
<html>
<?php $view = $this->layout()->getView(); ?>
	<head>
		<meta charset="utf-8">
		<?php $config = Zend_Registry::get("config"); ?>
		<title><?php echo $config->site->title ?></title>
		<link rel="shortcut icon" href="<?php echo $config->url->base . '/' . $config->site->ico ?>" />
		<link rel="stylesheet" media="screen" href="<?php echo $this->url(array('action' => 'screen'), 'css'); ?>" />

		<link rel="stylesheet" media="screen" href="<?php echo $this->url(array('action' => 'screen','media' => $config->template->name, 'name'=> 'stylesheets'), 'medias'); ?>/font-awesome.min.css" />
		<?php if (isset($view->csss)): foreach ($view->csss as $css): ?>
		  <link rel="stylesheet" media="screen" href="<?php echo $this->url(array('type' => 'css', 'media' => $config->template->name, 'name' => $css), 'medias'); ?>" />
		<?php endforeach; endif; ?>
		
		<script src="<?php echo $this->url(array(), 'js'); ?>"></script>
		<?php if (isset($view->javascripts)): foreach ($view->javascripts as $js): ?>
		  <script src="<?php echo $this->url(array('type' => 'js', 'media' => $config->template->name, 'name' => $js), 'medias'); ?>"></script>
		<?php endforeach; endif; ?>

	</head>
	<body>
		<header>
			<a href="<?php echo $this->url(array(), 'default', true); ?>">
				<img id="logo" src="<?php echo $config->url->base . '/' . $config->site->logo ?>"/>
			</a>
		</header>
		<div class="container">
			<div id="container-wrapper" class="row">
				<?php if ($this->isLogged): ?>
				<div class="col-sm-3 col-xs-12">
					<h3><?= $this->login?></h3>
					<p>
						<a href="<?php echo $this->url(array('controller' => 'profile'), 'default', true) ?>" class="btn btn-info" role="button"><?= T_('Profile')?></a>
 						<a href="<?php echo $this->url(array('controller' => 'logout'), 'default', true) ?>" class="btn btn-danger" role="button"><?= T_('Logout')?></a>
					</p>
					<div class="list-group">
						<?php
							$array = array();
							$array['index'] = T_('Home');
							if ($this->isAdmin)	$array['admin'] = T_('Admin');
							foreach ($array as $menuLink => $menuLabel): ?>
							<a class="list-group-item<?php echo ($menuLink == $this->controller ? ' active' : ''); ?>" href="<?php echo $this->url(array('controller' => $menuLink), 'default', true) ?>" ><span><?php echo T_($menuLabel); ?></span></a></li>
							<?php endforeach; ?>
						<?php if (!empty($this->layout()->getView()->submenu)): ?>
							<?php foreach($this->layout()->getView()->submenu as $item): ?>
									<?php if (isset($item['href'])): ?>
										<a class="list-group-item" href="<?php echo htmlspecialchars($this->url(array('controller' => ''), 'default', true) . $item['href']); ?>">
											<?php echo htmlspecialchars(T_($item['label'])); ?>
										</a>
									<?php elseif (isset($item['url'])): ?>
										<?php $route = (isset($item['route']) ? $item['route'] : null); ?>
										<a class="list-group-item<?php echo ( ($item['url']['controller'] == $this->controller OR $item['url']['action'] == $this->action) ? ' active' : ''); ?>" href="<?php echo htmlspecialchars($this->url($item['url'], $route, true)); ?>">
											<?php echo htmlspecialchars(T_($item['label'])); ?>
										</a>
									<?php else: ?>
										<h3 class="list-group-item list-group-item-success"><?php echo T_($item['label']); ?></h3>
									<?php endif; ?>
							<?php endforeach; ?>
						<?php endif; ?>
					</div>
				</div>
			<?php endif; ?>

				<div id="main"><?php echo $this->layout()->content ?></div>
				<div id="hspacer">&nbsp;</div>
				<footer>Footer</footer>
			</div>
		</div>
	</body>
</html>
